<template>
  <h2>当前求和：{{ sum }}</h2>
  <button @click="sum++">点击+1</button>
  <br>
  <h1>鼠标坐标X:{{ point.x }},{{ point.y }}</h1>
</template>

<script>
// 体现出了组合式API的使用
import { ref } from "vue";
import usePoint from "../hooks/usePoint"

export default {
  name: "myDemo",
  setup() {
    // (1)setup相当于beforeCreated、created
    console.log("---setup---");

    let sum = ref(0);

    let point = usePoint()
    return {
      sum,
      point
    };
  },
};
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped></style>
